package com.tsp_tux.demo.Mapper;

import com.tsp_tux.demo.Entity.Subject_2;
import com.tsp_tux.demo.Entity.Subject_Student;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.tsp_tux.demo.Entity.SubjectInfo_1;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface SubjectMapper {
    @Select("select sid,subname,date,content,username from subject natural join user order by rand() limit 6")
    List<Subject_2> getRandom6();

    @Select("select iconurl,email,username,uid from user where uid=#{uid}")
    Subject_Student checkStudent(@Param("uid")String uid);

    @Select("select count(*) from article where uid=#{uid} and sid=#{sid} and state=1")
    int queryCount(@Param("uid")String uid, @Param("sid")int sid);

    /**
     * @param keyword String 关键字
     * @return 搜索专题
     * @author 童一凡
     */
    public List<String> searchBlogByKeyword(String keyword);
    public SubjectInfo_1 searchBlogByKeyword2(String sid);


    /**@author 周志伟
     * 	get[专题参与人数,专题教师文章数,专题资源数,学生知识分享数,学生心得数目]
     */
    int getAttendNum(int sid);
    int getTeachArticleNum(int sid);
    int getResourceNum(int sid);
    int getStudentShareNum(int sid);
    int getThinkNum(int sid);
}

